Skip to content

.NET: Fix and re-enable flaky InputWaiter timeout test - #7377

Merged
peibekwe merged 1 commit into
microsoft:mainfrom
peibekwe:workflow-testfix
Jul 29, 2026
Merged

.NET: Fix and re-enable flaky InputWaiter timeout test#7377
peibekwe merged 1 commit into
microsoft:mainfrom
peibekwe:workflow-testfix

Conversation

@peibekwe

Copy link
Copy Markdown
Contributor

Motivation & Context

InputWaiterTests.InputWaiter_WaitForInputAsync_CompletesWhenTimeoutExpiresAsync was quarantined in #7361 because it failed intermittently on the net472/windows-latest leg of merge_group runs, blocking the merge queue for PRs that never touched workflow code.

The test raced a 300ms wait against a 5s Task.Delay and then asserted which one won by comparing task identity. That assertion measured scheduling latency rather than behaviour: SemaphoreSlim.WaitAsync(timeout) reaches its timeout through several thread-pool hops, while Task.Delay completes directly in its timer callback. On a loaded runner the semaphore honored its 300ms timeout exactly, but the continuation was not observed until after the 5s guard, so the delay won and the test failed.

Re-enable the quarantined test and also fix related siblings. Fixes #7360

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

@peibekwe peibekwe self-assigned this Jul 29, 2026
Copilot AI review requested due to automatic review settings July 29, 2026 02:59
@peibekwe
peibekwe temporarily deployed to github-app-auth July 29, 2026 02:59 — with GitHub Actions Inactive
@peibekwe
peibekwe temporarily deployed to github-app-auth July 29, 2026 02:59 — with GitHub Actions Inactive
@peibekwe
peibekwe temporarily deployed to github-app-auth July 29, 2026 02:59 — with GitHub Actions Inactive
@agent-framework-automation agent-framework-automation Bot added .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Jul 29, 2026
@github-actions github-actions Bot changed the title Fix and re-enable flaky InputWaiter timeout test .NET: Fix and re-enable flaky InputWaiter timeout test Jul 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a previously quarantined flaky workflows unit test by removing a wall-clock race and asserting timeout behavior via the API result instead of task scheduling/identity, allowing the test to be re-enabled without destabilizing net472 CI legs.

Changes:

  • Introduces a consistent “guard timeout” backstop in InputWaiterTests to prevent hangs while keeping assertions focused on behavior.
  • Rewrites the timeout test (and related siblings) to assert on a boolean result (signaled vs timed out) rather than racing SemaphoreSlim.WaitAsync(timeout) against Task.Delay.
  • Updates InputWaiter.WaitForInputAsync(TimeSpan, ...) to return bool, exposing whether the wait ended due to a signal or a timeout.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InputWaiterTests.cs Re-enables and stabilizes the timeout test by asserting on a returned flag and adding a liveness guard.
dotnet/src/Microsoft.Agents.AI.Workflows/Execution/InputWaiter.cs Returns a boolean from the timeout wait overload to distinguish signal vs timeout and support non-flaky tests.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 5 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by peibekwe's agents

@peibekwe
peibekwe marked this pull request as ready for review July 29, 2026 03:14
@peibekwe
peibekwe temporarily deployed to github-app-auth July 29, 2026 03:14 — with GitHub Actions Inactive

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 5 | Confidence: 94% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by peibekwe's agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Flaky test] InputWaiterTests.InputWaiter_WaitForInputAsync_CompletesWhenTimeoutExpiresAsync

5 participants